package com.muki.repository;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;

import com.muki.configuration.ExtractorCacheProperties;
import com.muki.contentSeen.Content;

public class ContentRepositoryImpl implements ContentRepositoryEnhance {

	@Resource private MongoTemplate mongoTemplate;
	
	@Autowired private ExtractorCacheProperties extractorCacheProperties;
	
	@Override
	public List<Content> findUnExtractContentLimit() {
		Query query = new Query();
		query.addCriteria(Criteria.where("status").is(false));
		query.with(new PageRequest(0, extractorCacheProperties.getMax()));
		return mongoTemplate.find(query, Content.class);
	}

}
